package com.adrian.api;

import com.adrian.pojo.Product;
import com.adrian.pojo.Type;
import com.adrian.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Auther: Adrian
 * @Date: 2020/3/19 21:02
 * @Description:
 */
@FeignClient(value = "springcloud-producer")
public interface ApiClient {

    @RequestMapping("/user_login")
    public User userLogin(@RequestBody User user);

    /**
     * 查询
     * @return
     */
    @RequestMapping("/product_list")
    public List<Product> getList();

    @RequestMapping("/product_addProduct")
    public int addProduct(@RequestBody Product product);
    /**
     * 据ID更新
     * @param product
     * @return
     */
    @RequestMapping("/product_updatebyId")
    public int updateProduct(@RequestBody Product product);

    /**
     * 根据ID查询对象
     * @param id
     * @return
     */
    @RequestMapping("/product_getById")
    public Product getById(@RequestParam int id);

    @RequestMapping("/type_getById")
    public Type getTypeById(@RequestParam int id);

    /**
     * 根据ID删除
     * @param id
     * @return
     */
    @RequestMapping("/product_delete")
    public int deleteProduct(@RequestParam int id);

    /**
     * 01-查询下拉框数据
     * @return
     */
    @RequestMapping("/product_types")
    public List<Type> getTypes();

    @RequestMapping("/addType")
    public int addType(@RequestBody Type type);

    /**
     * 根据ID删除
     * @param id
     * @return
     */
    @RequestMapping("/type_delete")
    public int deleteType(@RequestParam int id);

    @RequestMapping("/type_updatebyId")
    public int updateType(@RequestBody Type type);


}
